 58b20109cf
			
		
	
	58b20109cf
	
	
	
		
			
			import sys
import yaml
with open(sys.argv[1]) as fp:
    data = fp.read()
if not data.find("---") == 0:
    # no head
    print("NO YAML HEAD FOUND")
    sys.exit(-1)
data = data[3:]
head_end = data.find("---")
head = data[0:head_end]
data = data[head_end+3:]
metadata = yaml.safe_load(head)
cats = metadata.pop('categories', None)
if cats != None:
    if type(cats) == list:
        tags = cats
    elif type(cats) == str:
        tags = cats.split()
    tags = list(map(lambda t: t.lower(), tags))
    metadata["tags"] = ", ".join(tags)
    new_data = f"---\n{yaml.dump(metadata, default_flow_style=False)}---{data}"
    # write it
    print(f"coverted: categories to tags: {tags} - {sys.argv[1]}")
    with open(sys.argv[1], "w") as fp:
        fp.write(new_data)
    sys.exit(0)
if not metadata.get("tags", None):
    metadata["tags"] = "untagged"
    new_data = f"---\n{yaml.dump(metadata, default_flow_style=False)}---{data}"
    print(f"untagged: {sys.argv[1]}")
    # write it
    with open(sys.argv[1], "w") as fp:
        fp.write(new_data)
    sys.exit(0)
print("No changes needed")
		
	
		
			
				
	
	
		
			33 lines
		
	
	
		
			644 B
		
	
	
	
		
			Markdown
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
		
			644 B
		
	
	
	
		
			Markdown
		
	
	
	
	
	
| ---
 | |
| author: dhananjayishere
 | |
| comments: true
 | |
| date: 2011-10-11 03:33:00
 | |
| layout: post
 | |
| slug: ffmepg-nokia-7210-video-clips
 | |
| tags: gnu/linux, multimedia, tips
 | |
| title: FFmpeg + Nokia 7210 Video Clips.
 | |
| wordpress_id: 74980538
 | |
| ---
 | |
| 
 | |
| Nokia 7210 supports video clips of container mp4 with following specifications.
 | |
| 
 | |
|  Video Codec: mpeg4
 | |
| Video Size: 320x240
 | |
| Bit Rate: 500
 | |
| Frame Rate: Auto
 | |
| Aspect: Auto
 | |
| Same Quality: False
 | |
| 
 | |
|  Audio:
 | |
| Audio Codec: mpeg4aac
 | |
| Bit Rate: 96
 | |
| Sample Rate: 44100
 | |
| Channels: 1 (Mono)
 | |
| Disable Audio: False
 | |
| 
 | |
|  So to make a clip playable in phone,
 | |
| 
 | |
|  Use
 | |
| 
 | |
|  ** ffmpeg -i <infile> -b 500 -s 320x240 -f mp4 -acodec libfaac -vcodec mpeg4 <outfile>**
 |