FabiUnne/youtube-upload

If resulting chunk is less than 900 seconds, the youtube-upload finishes prematurely

Closed this issue · 8 comments

What steps will reproduce the problem?

1. Take a video that ffmpeg chops incorrectly
2. Launch youtube-upload on it
3. Observe only the first chunk to be uploaded

What version of youtube-upload are you using? On what operating system?
0.5

Please provide any additional information:
Seems stream 0 codec frame rate differs from container frame rate: 1000.00 
(1000/1) -> 25.00 (25/1)
Input #0, matroska, from '1.mkv':
  Metadata:
    doctype         : matroska
  Duration: 03:02:49.72, start: 0.000000, bitrate: N/A
    Stream #0.0: Video: rv40, yuv420p, 352x264, PAR 1:1 DAR 4:3, 25 tbr, 1k tbn, 1k tbc
    Stream #0.1: Audio: vorbis, 48000 Hz, mono, s16
Output #0, matroska, to '1-1.partial.mkv':
  Metadata:
    encoder         : Lavf52.64.2
    Stream #0.0: Video: 0x0000, yuv420p, 352x264 [PAR 1:1 DAR 4:3], q=2-31, 1k tbn, 1k tbc
    Stream #0.1: Audio: libvorbis, 48000 Hz, mono
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1
Press [q] to stop encoding
frame=11195 fps=11165 q=-1.0 size=   28415kB time=447.76 bitrate= 519.9kbits/s  
frame=18029 fps=11988 q=-1.0 size=   45767kB time=721.12 bitrate= 519.9kbits/s  
frame=22499 fps=12170 q=-1.0 Lsize=   57112kB time=899.92 bitrate= 519.9kbits/s 

video:52075kB audio:4724kB global headers:0kB muxing overhead 0.551022%
--- run: ffmpeg -i 1-1.mkv
--- chunk file size: 58482642 (max: 2000000000)
--- chunk duration: 899 (max: 900)
--- end of video reached: 1 chunks created
--- connecting to Youtube API
--- start upload: 1-1.mkv (SKA_Author)

Original issue reported on code.google.com by skliarie@gmail.com on 15 Feb 2011 at 12:05

I dont' fully understand, how long is the original video? one chunk is created 
and one uploaded, that second part is correct, right? 

if you can, upload the video somewhere so I can test directly.

Original comment by tokland on 15 Feb 2011 at 12:12

The original video is about 3 hours length. The problem is actually in the way 
ffmpeg chops that particular video file. I am not sure whether the video has 
odd framerate or something else, but the video can not be chopped squarely at 
the 900 seconds. Attempt to chop at the 900 seconds resulted in chop at 899.92. 
To provide you with a sample I tried to chop the video at 2000 seconds, but the 
result was chopped at the 1999.91 seconds.
http://212.179.137.52/odd_chop_by_ffmpeg.mkv

The end result is that the youtube-upload sees that the video is shorter than 
the 900 seconds requested and decides that this is the last chunk.

Original comment by skliarie@gmail.com on 15 Feb 2011 at 12:28

Indeed, there have been reports about ffmpeg not being able to split videos 
well, and yes, the framerate was usually the one to blame. If you have problems 
splitting the video you can try to convert it to another format first, but I 
understand a 3-hour video is not easy to work with. 

So, try first to split the video manually. One option the script should have (I 
think it does not) is being able to upload N existing videos (tagging them as 
usual: title N/total), so people can do their own spliting. What do you think?

Original comment by tokland on 15 Feb 2011 at 12:36

The -ss parameter of ffmpeg allows fractions. You should detect the point the 
previous chunk was chopped at and use that value to seek in the video to the 
next chunk.

Currently the youtube-upload treats the duration of the video chunk as even 
number, disregarding fractions.

Original comment by skliarie@gmail.com on 15 Feb 2011 at 12:51

I an not sure calculating the exact duration will help here, you think? anyway, 
it's very simple to do that, check it:

--- youtube_upload/youtube_upload.py    (revisión: 91)
+++ youtube_upload/youtube_upload.py    (copia de trabajo)
@@ -84,12 +84,12 @@
         return
     strduration = match.group(1)
     return sum(factor*float(value) for (factor, value) in 
-               zip((60*60, 60, 1), strduration.split(":")))
+               zip((60*60, 60, 1, 0.01), re.split("[:\.]", strduration)))

Original comment by tokland on 15 Feb 2011 at 10:28

Any news? 

For some days I'll be using a fast-speed link, if you provide a link for the 
video I'll take a look.

Original comment by tokland on 19 Feb 2011 at 9:57

youtube removed pretty much all limitations (only <2Gb survive), and I've 
decided to remove ffmpeg split completely from the package. 

Original comment by tokland on 13 Mar 2011 at 12:24

  • Changed state: Done

Original comment by tokland on 13 May 2014 at 2:55